//
//  QTMutableDictionary.h
//  Pods
//
//  Created by 张俊博 on 16/8/25.
//
//

#import <Foundation/Foundation.h>
#include <pthread.h>
#import <libkern/OSAtomic.h>
#import <objc/message.h>

/**
 *  线程安全
 */

@interface QTMutableDictionary : NSObject
{
@protected
    pthread_mutex_t     _mutex;
    NSMutableDictionary      *_safeDictionary;
//    OSSpinLock          _lock;
//    dispatch_semaphore_t  _signal;
}

@property (nonatomic, strong) NSMutableDictionary *safeDictionary;

- (id)objectForKey:(id)aKey;
- (NSArray *)allKeys;
- (NSArray *)allKeysForObject:(id)anObject;
- (NSArray *)allValues;
- (void)removeObjectForKey:(id)aKey;
- (void)setObject:(id)anObject forKey:(id)aKey;
- (void)removeAllObjects;
- (void)removeObjectsForKeys:(NSArray *)keyArray;
- (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary;
- (void)setDictionary:(NSDictionary *)otherDictionary;
- (NSMutableDictionary *)safeDictionaryCopy;

- (NSUInteger)count;

@end
